[PATCH] squashfs: Fix stack overflow while symlink resolving
authorRichard Weinberger <richard@nod.at>
Fri, 2 Aug 2024 16:36:47 +0000 (18:36 +0200)
committerAndreas Henriksson <andreas@fatal.se>
Tue, 23 Jun 2026 19:07:40 +0000 (21:07 +0200)
commitb8097f1f0622ee1217856168499f9d128f76deaf
tree438247ff838f9f35517623af168b252ac38e29d8
parent1fd82f5408a8e302ced5747d9cdce5645f1499e4
[PATCH] squashfs: Fix stack overflow while symlink resolving

The squashfs driver blindly follows symlinks, and calls sqfs_size()
recursively. So an attacker can create a crafted filesystem and with
a deep enough nesting level a stack overflow can be achieved.

Fix by limiting the nesting level to 8.

Signed-off-by: Richard Weinberger <richard@nod.at>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-By: Daniel Leidert <dleidert@debian.org>
Origin: https://source.denx.de/u-boot/u-boot/-/commit/4f5cc096bfd0a591f8a11e86999e3d90a9484c34
Bug: https://www.openwall.com/lists/oss-security/2025/02/17/2
Bug-Debian: https://bugs.debian.org/1098254
Bug-Debian-Security: https://security-tracker.debian.org/tracker/CVE-2024-57257
Bug-Freexian-Security: https://deb.freexian.com/extended-lts/tracker/CVE-2024-57257

Gbp-Pq: Name CVE-2024-57257.patch
fs/squashfs/sqfs.c